package com.mergades.consumer;

import com.mergades.provider.SayHello;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@ImportResource("classpath:dubbo-consumer.xml")
public class DubboConsumerApplication  {
    @Reference
    private SayHello sayHello;

    @RequestMapping("/hello")
    public String say(@RequestParam("name") String name) {
        return sayHello.sayHello();
    }


    public static void main(String[] args) {
        SpringApplication.run(DubboConsumerApplication.class, args);
    }

}
